//这是文章的路由模块
const express = require('express')
const router = express.Router()


//导入multer和 path
const multer = require('multer')
const path = require('path')

//创建multer 的实例
const uploads = multer({ dest: path.join(__dirname, '../uploads') })

const expressJoi = require('@escook/express-joi')

const { add_article_schema } = require('../schema/article')

const article_handler = require('../router_handler/article')
router.post('/add', uploads.single('cover_img'), expressJoi(add_article_schema), article_handler.addArticle)

module.exports = router